package Computer_Builder_04;
import Computer_Builder_04.Director.Director;
import Computer_Builder_04.Product.Product;

public class ComputerApplication {
    public static void main(String[] args) {
        Director director = new Director();

        // 构建笔记本电脑
        Product laptop = director.constructComputer("Laptop");
        System.out.println("笔记本电脑产品组成");
        printComputerInfo(laptop);

        // 构建台式机
        Product desktop = director.constructComputer("Desktop");
        System.out.println("台式机产品组成");
        printComputerInfo(desktop);

        // 构建服务器
        Product server = director.constructComputer("Server");
        System.out.println("服务器产品组成");
        printComputerInfo(server);
    }

    private static void printComputerInfo(Product product) {
        System.out.println(product.getCPU());
        System.out.println(product.getRAM());
        System.out.println(product.getHDD());
        System.out.println(product.getMonitor());
        System.out.println(product.getHost());
        System.out.println();
    }
}